﻿using System;
using System.Collections.Generic;
using System.Text;
using AspNetCs.Model;
using System.Data;
using System.Data.SqlClient;

namespace AspNetCs.IDAL
{
    public interface IUser
    {
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int update(Users_Model model);

        /// <summary>
        /// 更新用户(后台修改)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int AdminUpdate(Users_Model model);

        /// <summary>
        /// 用户添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int Add(Users_Model model);
        Users_Model GetModel(DataRow dr);
        /// <summary>
        /// 彻底删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        int Del(int id);
        /// <summary>
        /// 用户锁定
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        int UserLock(int UserId);
        /// <summary>
        /// 解除用户锁定
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        int UserUnLock(int UserId);
        int IsObjUserName(string UserName);
        /// <summary>
        /// 用户登录验证[返回结果:0=失败，1=成功，-1=未知错误,-2=用户锁定]
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int UserLogin(Users_Model model);

        /// <summary>
        /// 根据WHERE条件返回DataTable,不要跟"Where"关键词
        /// </summary>
        /// <param name="filter">Where条件</param>
        /// <param name="Sp">System.Data.SqlClient.SqlParameter[]参数</param>
        /// <returns></returns>
        DataTable GetDataTable(string filter, SqlParameter[] Sp);
        /// <summary>
        /// 更新最后登录时间与IP
        /// </summary>
        /// <param name="Filter"></param>
        void UpdateLastLoginTime(string Filter);
        /// <summary>
        /// 更新最后退出时间
        /// </summary>
        /// <param name="Filter"></param>
        void UpdateLastOutTime(string Filter);
        /// <summary>
        /// 检查用户是否在线,
        /// </summary>
        /// <param name="Filter">where条件,请直接以" and "开头</param>
        /// <param name="checkTime_Int">验证时间</param>
        void CheckUserOnline(string Filter, int checkTime_Int);
        /// <summary>
        /// 密码更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int updatePwd(Users_Model model);

        /// <summary>
        /// 扣除用户点数
        /// </summary>
        /// <param name="Point">扣除的点数</param>
        /// <param name="UserId">用户编号</param>
        void DrePoint(int Point, int UserId);
    }
}
